home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / graphics / aim_xtra.arc / DEMTABLE.AIM < prev    next >
Text File  |  1988-08-17  |  4KB  |  159 lines

  1. * @demtable demonstrates the table command.
  2. * table: transforms a grey value image using a look-up table.
  3. *
  4. * The grey value g from the input image (first parameter) is used 
  5. * as table address,  the content found there becomes the grey value 
  6. * h in the output image (second parameter).
  7. shad a
  8. copy a b 1 1 0 1 1 0 
  9. *transposed
  10. * Several tables can  be generated (third parameter, t):
  11. * t=0: (h/255)=(g/255)**(j/k);    
  12. table a d 0 1 2  
  13. * j/k=1/2, power, square root 
  14. add b d 
  15. th d d 1 127
  16. table a d 0 2 1  
  17. * j/k=2/1, power, square 
  18. add b d 
  19. th d d 1 127
  20. * t=0: (h/255)=g**(j/k), for j/k<0 different scaling: g instead of g/255;    
  21. table a d 0 -1 1  
  22. * j/k=-1/1, neg.power 
  23. add b d 
  24. th d d 1 127
  25. * t=2: (h/255)=(k/g)**j;
  26. table a d 2 1 1  
  27. * 255/g, reciprocal 
  28. add b d 
  29. th d d 1 127
  30. * t=1: (h/255)=(j/k)**((g/255)-1);   j=0 -> j/k=e;
  31. table a d 1 10 1  
  32. * exponential, base 10 
  33. add b d 
  34. th d d 1 127
  35. table a d 1 0 1  
  36. * exponential, base e 
  37. add b d 
  38. th d d 1 127
  39. * t=-1: (h/255)-1=log(g/255)/log(j/k); 
  40. table a d -1 10 1 1 
  41. * logarithm, base 10 
  42. add b d 
  43. th d d 1 127
  44. table a d -1 0 1 1 
  45. * logarithm, base e 
  46. add b d 
  47. th d d 1 127
  48. * t=3: pi2 (h-127-j)/127=atan((k/100) pi2 (g-127)/128  - tan(pi2 j/127)); pi2=pi/2;
  49. * t=3:      h           =atan((k/100)      g           -  (k/100) gj   );    
  50. table a d 3 0 100 1
  51. * arctangent S-curve
  52. add b d 
  53. th d d 1 127
  54. * t=-3: pi2 (h-127)/128=(tan(pi2 (g-127-j)/127)+tan(pi2 j/127)) /(k/100); pi2=pi/2;
  55. * t=-3:      h         =(tan     (g    -j)     +   (k/100) gj ) /(k/100);
  56. table a d -3 0 100 1
  57. * tangent inverse S-curve
  58. add b d
  59. th d d 1 127
  60. * t=4: g=(x+8)+16*(y+8)->h=phi*16/2pi+16*r;
  61. cdiv a 16 c *steps x-axis 0 1 2 ... 15
  62. cdiv b 16 d 
  63. cmul d 16   *steps y-axis 0 16 32 .. 240
  64. sub d c 15 d  *0+15 0+14 .. 0+0, 16+15 .. 16+0 ,, 240+15 .. 240+0
  65. table d c 4  
  66. cdiv c 16 d
  67. cmul d 16 
  68. sub c d 0 c
  69. * cartesian to polar
  70. add d c  
  71. * t=-4:  inverse of t=4;
  72. table c d -4  
  73. * polar to cartesian
  74. cdiv d 16 c 
  75. cmul c 16
  76. sub d c 0 d
  77. * t=5: (h-127)/127=cos((g/255)**(j/100) *k*2pi);
  78. * t=5:  h         =cos(      g**j       *k*2pi);
  79. table a d 5 100 1 
  80. * cosine
  81. add b d 
  82. th d d 1 127
  83. table a d 5 200 5 
  84. * chirped cosine
  85. add b d 
  86. th d d 1 127
  87. * t=-5: (h-127)/127=sin((g/255)**(j/100) *k*2pi);
  88. * t=-5:  h         =sin(      g**j       *k*2pi); 
  89. table a d -5 100 1 1
  90. * sine
  91. add b d 
  92. th d d 1 127
  93. table a d -5 200 5 1
  94. * chirped sine
  95. add b d 
  96. th d d 1 127
  97. * t=6: 8 thresholds j,j+k,,j+7k;
  98. table a d 6 30 20 1
  99. bd d 1 * thr 30
  100. bd d 2 * thr 50
  101. bd d 3 * thr 70
  102. bd d 4 * thr 90
  103. bd d 5 * thr 110
  104. bd d 6 * thr 130
  105. bd d 7 * thr 150
  106. bd d 8 * thr 170
  107. * t=-6: j=lower, k=higher threshold;
  108. table a d -6 85 170 1
  109. add b d
  110. th d d 1 127
  111. * t=7: (h-127)/127=-log( (254/g)-1 )/log(253); 
  112. table a c 7 
  113. * symmetric logarithm, log( (254/g)-1 ) = log(254-g)-log(g);
  114. add b c d
  115. th d d 1 127
  116. * t=-7: (254/h)-1= exp( -((g-127)/127) log(253) );
  117. table c d -7 
  118. * inverse of symmetric logarithm
  119. add b d 
  120. th d d 1 127
  121. * t=8: (h/255)=( a**(g/255) + a**(-g/255) -2) / (a+1/a-2); a=j/k;
  122. table a d 8 0 1 
  123. * cosinus hyperbolicus -1, base e 
  124. add b d 
  125. th d d 1 127
  126. * t=-8: (h/255)=log( (g/255) +1 + sqrt( ((g/255) +1)**2-1) ))/log(j/k); 
  127. table a d -8 0 1  
  128. * inverse of cosh-1, base e 
  129. add b d 
  130. th d d 1 127
  131. * Fourth para.(r) reflects table: r=1: normal, default;
  132. table a d 0 2 1 1 *square 
  133. add b d 
  134. th d d 1 127
  135. * r=2: g->-g;
  136. table a d 0 2 1 2
  137. add b d 
  138. th d d 1 127
  139. *  r=3: g->-g, h->-h;
  140. table a d 0 2 1 3
  141. add b d 
  142. th d d 1 127
  143. * r=4: h->-h; 
  144. table a d 0 2 1 4
  145. add b d 
  146. th d d 1 127
  147. * r=5: g->|g|; 
  148. table a d 0 2 1 5
  149. add b d 
  150. th d d 1 127
  151. * r=6: g->|g|, h-> |h|*sgn(g),
  152. table a d 0 2 1 6
  153. add b d 
  154. th d d 1 127
  155. * r<0: h->h+r[mod256].
  156. table a d 0 2 1 -16
  157. add b d
  158. th d d 1 127
  159.